<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>自定义组件</title>
<script src="https://cdn.staticfile.org/react/16.4.0/umd/react.development.js"></script>
<script src="https://cdn.staticfile.org/react-dom/16.4.0/umd/react-dom.development.js"></script>
<script src="https://cdn.staticfile.org/babel-standalone/6.26.0/babel.min.js"></script>
</head>
<body>
	<div id = "example"></div>
	<script type="text/babel">
	
	{/**
		方式一：我们可以使用函数定义了一个组件
		function CustomComponment(props){
        return <h1>Hello World-自定义组件 {props.name}</h1>;
     }
     **/}

     {/**
          方式二： ES6 class 来定义一个组件:  
	 **/}
     	class  CustomComponment extends React.Component {
	     render(){
            return <h1>Hello World-自定义组件 {this.props.name}</h1>;
	       }
	    }
	

     
     
    const element = <CustomComponment name = '刘子彬'/>;

   ReactDOM.render(
	element,
	document.getElementById('example')
);

	</script>


</body>
</html>